<template>
  <div class="goods-container">
    <div class="goods-content">
      <div class="img">
        <mt-swipe :auto="4000">
          <mt-swipe-item>
            <img :src="goods.ImgUrl">
          </mt-swipe-item>
        </mt-swipe>
      </div>
      <div class="info">
        <p class="title">{{ goods.GoodsName}}</p>
        <p class="content">{{ goods.TjRemark }}</p>
        <p class="price">
          <span class="sell_price">
            ￥{{ goods.LastPrice }}
            <sub>卷后价</sub>
          </span>
          <span>
            优惠券
            <strong>{{ goods.ActMoney }}</strong>元
          </span>
          <span class="person_ym">
            <span class="mui-icon-extra mui-icon-extra-peoples"></span>
            <strong>{{ goods.SaleCount}}</strong>人已买
          </span>
        </p>
        <p class="goods-p">
          <span>天猫</span>
          <span>新品</span>
          <span>包邮</span>
        </p>
      </div>
      <a :href="goods.ActLink">
        <mt-button type="danger" size="large">领券并购买</mt-button>
      </a>
    </div>
  </div>
</template>


<script>
import { Toast } from "mint-ui";
export default {
  data: function(params) {
    return {
      id: this.$route.params.id, //存放从url 中获取的id
      goods: {}
    };
  },
  created() {
    this.getGoods();
  },
  methods: {
    getGoods() {
      this.$http
        .get(
          "http://api.xuandan.com/DataApi/item?AppKey=4y0juvewel&id=" + this.id
        )
        .then(result => {
          console.log(result);
          if (result.body.error == 0) {
            this.goods = result.body.data[0];
          } else {
            Toast("获取数据失败！");
          }
        });
    }
  }
};
</script>


<style lang="scss" scoped>
.goods-container {
  .img {
    .mint-swipe {
      height: 300px;
      padding: 0 40px;
      background-color: #ebe9e994;
      img {
        width: 100%;
        display: block;
      }
    }
  }
  .info {
    padding: 0 5px;
    .title {
      font-size: 14px;
      color: #101010;
    }
    .content {
      color: red;
    }
    .price {
      display: flex;
      justify-content: space-between;
      .sell_price {
        font-size: 15px;
        color: red;
        font-weight: 700;
        sub {
          margin-left: 2px;
          font-size: 8px;
          color: #cecede;
          font-weight: normal;
        }
      }
      .person_ym {
        font-size: 10px;
        .mui-icon-extra-peoples {
          vertical-align: middle;
          font-size: 8px;
          margin-right: 3px;
        }
      }
      strong {
        color: red;
      }
    }
    .goods-p {
      span {
        margin-left: 4px;
        font-size: 6px;
        padding: 2px;
        color: red;
        border: 1px solid red;
      }
    }
 
  }
}
</style>
